package com.ice.body.active.controller;

import com.ice.base.controller.BaseController;
import com.ice.base.result.AjaxResult;
import com.ice.body.active.service.ActiveMainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created with GuoYanBin.
 * Description:
 * Date: 2022-10-18
 * Time: 11:47
 */
@RestController
@Api(tags = "激活系统")
public class ActiveMainController extends BaseController{
    //---------------------------激活主表-----------------------start
    @Resource
    private ActiveMainService activeMainService;
    
    @ApiOperation(value = "激活")
    @PostMapping("/api/ActiveMain/active")
    public AjaxResult<T> active(@RequestParam("actCode") String actCode) {
        AjaxResult r = AjaxResult.error("激活失败或已激活");
        try{
            Integer active = activeMainService.active(actCode);
            if(1 ==active){
                return AjaxResult.success("激活成功");
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return r;
    }


}
